/***********************************************************
 *  File_Name  : XJAny.h
 *  File_Path   :
 *  File_Encode : UTF8
 *  Description :
 *
 *  OS : Linux, UNIX
 *  LastVersion  : 20150128
 *
 *  Author      : LiXiujie(李秀杰)
 *  Date        : 2015-1-28
 *  Version     : 20150128
 *  Description :
 *
 *  Edit Author :
 *  Edit Date   :
 *  Version     :
 *  Description :
 *
 ***********************************************************/
#ifndef XJANY_H_
#define XJANY_H_

#include <typeinfo>
#include <string.h>
#include <stdlib.h>
#include <string>
#include <map>
#include <math.h>
#include "XJExcepction.h"

namespace XJUtilClass {

class XJAny {
public:
	enum XJANY_TYPE{
		TYPE_SHORT=0,   /* short */
		TYPE_LONG=1,    /* long  */
		TYPE_CHAR=2,    /* char */
		TYPE_FLOAT=3,   /* float */
		TYPE_DOUBLE=4,  /* double */
		TYPE_STRING=5,  /* string,std::string,char * */
		TYPE_CARRAY=6,  /* carray,byte*,unsigned char *,  */
		TYPE_PTR=7,     /* pointer,void* */
		TYPE_OBJECT=10, /* object */
		TYPE_ARRAY=11,  /* array */
		TYPE_NULL=99,    /* null */
		TYPE_INT=100,    /* int */
		TYPE_LONG_LONG=101,    /* long long */
		TYPE_LONG_DOUBLE=102    /* long double */
	};

	XJAny(){
		// TODO Auto-generated destructor stub
		m_nType = TYPE_NULL;
		m_nLen = 0;
		m_pData = 0;
	}
	void Clear(){
		m_nType = TYPE_NULL;
		m_nLen = 0;
		if (m_pData){
			free(m_pData);
			m_pData = 0;
		}
	}

	XJAny(const short &value){
		m_nType = TYPE_SHORT;
		m_nLen = sizeof(value);
		m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		memcpy(m_pData, &value, m_nLen);
	}

	XJAny(const unsigned short &value){
		m_nType = TYPE_SHORT;
		m_nLen = sizeof(value);
		m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		memcpy(m_pData, &value, m_nLen);
	}
	XJAny(const int &value){
		m_nType = TYPE_INT;
		m_nLen = sizeof(value);
		m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		memcpy(m_pData, &value, m_nLen);
	}
	XJAny(const unsigned int &value){
		m_nType = TYPE_INT;
		m_nLen = sizeof(value);
		m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		memcpy(m_pData, &value, m_nLen);
	}
	XJAny(const long &value){
		m_nType = TYPE_LONG;
		m_nLen = sizeof(value);
		m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		memcpy(m_pData, &value, m_nLen);
	}
	XJAny(const unsigned long &value){
		m_nType = TYPE_LONG;
		m_nLen = sizeof(value);
		m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		memcpy(m_pData, &value, m_nLen);
	}
	XJAny(const long long &value){
		m_nType = TYPE_LONG_LONG;
		m_nLen = sizeof(value);
		m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		memcpy(m_pData, &value, m_nLen);
	}

	XJAny(const unsigned long long &value){
		m_nType = TYPE_LONG_LONG;
		m_nLen = sizeof(value);
		m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		memcpy(m_pData, &value, m_nLen);
	}

	XJAny(const char &value){
		m_nType = TYPE_CHAR;
		m_nLen = sizeof(value);
		m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		memcpy(m_pData, &value, m_nLen);
	}
	XJAny(const unsigned char &value){
		m_nType = TYPE_CHAR;
		m_nLen = sizeof(value);
		m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		memcpy(m_pData, &value, m_nLen);
	}
	XJAny(const float &value){
		m_nType = TYPE_FLOAT;
		m_nLen = sizeof(value);
		m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		memcpy(m_pData, &value, m_nLen);
	}
	XJAny(const double &value){
		m_nType = TYPE_DOUBLE;
		m_nLen = sizeof(value);
		m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		memcpy(m_pData, &value, m_nLen);
	}
	XJAny(const long double &value){
		m_nType = TYPE_LONG_DOUBLE;
		m_nLen = sizeof(value);
		m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		memcpy(m_pData, &value, m_nLen);
	}
	XJAny(const std::string &value){
		m_nType = TYPE_STRING;
		m_nLen = value.size();
		m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		memcpy(m_pData, value.c_str(), m_nLen);
	}
	XJAny(const char * value, const unsigned long &nLen = 0){
		if (0 == value){
			throw XJExcepction("XJAny(const char *value, const unsigned long &nLen) Excepction.value is null.");
		}
		m_nType = TYPE_STRING;
		m_nLen = nLen;
		if (nLen == 0 && value){
			m_nLen = strlen(value);
		}
		m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		memcpy(m_pData, value, m_nLen);
	}
	XJAny(const unsigned char * value, const unsigned long &nLen){
		if (0 == value){
			throw XJExcepction("XJAny(const unsigned char *value, const unsigned long &nLen) Excepction.value is null.");
		}
		m_nType = TYPE_CARRAY;
		m_nLen = nLen;
		if (nLen == 0){
			throw XJExcepction("XJAny(const unsigned char *value, const unsigned long &nLen) Excepction.nLen is 0.");
		}
		m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		memcpy(m_pData, value, m_nLen);
	}
	XJAny(const void * value){
		if (0 == value){
			throw XJExcepction("XJAny(const void * value) Excepction.value is null.");
		}
		m_nType = TYPE_PTR;
		m_nLen = sizeof(void *);
		m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		*(long *)m_pData = (long)value;
		//memcpy(m_pData, &value, m_nLen);
	}
	XJAny(const XJAny &any){
		m_nType = any.m_nType;
		m_nLen = any.m_nLen;
		m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		memcpy(m_pData, any.m_pData, m_nLen);
	}
	virtual ~XJAny(){
		// TODO Auto-generated destructor stub
		m_nType = TYPE_NULL;
		m_nLen = 0;
		if (m_pData){
			free(m_pData);
			m_pData = 0;
		}
	}
	XJAny & operator=(const short &value ){
		m_nType = TYPE_SHORT;
		if (m_nLen < sizeof(value)){
			if (m_pData){
				free(m_pData);
				m_pData = 0;
			}
		}
		m_nLen = sizeof(value);
		if (0 == m_pData) m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		memcpy(m_pData, &value, m_nLen);
		return *this;
	}

	XJAny & operator=(const unsigned short &value ){
		m_nType = TYPE_SHORT;
		if (m_nLen < sizeof(value)){
			if (m_pData){
				free(m_pData);
				m_pData = 0;
			}
		}
		m_nLen = sizeof(value);
		if (0 == m_pData) m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		memcpy(m_pData, &value, m_nLen);
		return *this;
	}


	XJAny & operator=(const int &value ){
		m_nType = TYPE_INT;
		if (m_nLen < sizeof(value)){
			if (m_pData){
				free(m_pData);
				m_pData = 0;
			}
		}
		m_nLen = sizeof(value);
		if (0 == m_pData) m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		memcpy(m_pData, &value, m_nLen);
		return *this;
	}
	XJAny & operator=(const unsigned int &value ){
		m_nType = TYPE_INT;
		if (m_nLen < sizeof(value)){
			if (m_pData){
				free(m_pData);
				m_pData = 0;
			}
		}
		m_nLen = sizeof(value);
		if (0 == m_pData) m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		memcpy(m_pData, &value, m_nLen);
		return *this;
	}
	XJAny & operator=(const long &value ){
		m_nType = TYPE_LONG;
		if (m_nLen < sizeof(value)){
			if (m_pData){
				free(m_pData);
				m_pData = 0;
			}
		}
		m_nLen = sizeof(value);
		if (0 == m_pData) m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		memcpy(m_pData, &value, m_nLen);
		return *this;
	}
	XJAny & operator=(const unsigned long &value ){
		m_nType = TYPE_LONG;
		if (m_nLen < sizeof(value)){
			if (m_pData){
				free(m_pData);
				m_pData = 0;
			}
		}
		m_nLen = sizeof(value);
		if (0 == m_pData) m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		memcpy(m_pData, &value, m_nLen);
		return *this;
	}
	XJAny & operator=(const long long &value ){
		m_nType = TYPE_LONG_LONG;
		if (m_nLen < sizeof(value)){
			if (m_pData){
				free(m_pData);
				m_pData = 0;
			}
		}
		m_nLen = sizeof(value);
		if (0 == m_pData) m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		memcpy(m_pData, &value, m_nLen);
		return *this;
	}
	XJAny & operator=(const unsigned long long &value ){
		m_nType = TYPE_LONG_LONG;
		if (m_nLen < sizeof(value)){
			if (m_pData){
				free(m_pData);
				m_pData = 0;
			}
		}
		m_nLen = sizeof(value);
		if (0 == m_pData) m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		memcpy(m_pData, &value, m_nLen);
		return *this;
	}
	XJAny & operator=(const char &value ){
		m_nType = TYPE_CHAR;
		if (m_nLen < sizeof(value)){
			if (m_pData){
				free(m_pData);
				m_pData = 0;
			}
		}
		m_nLen = sizeof(value);
		if (0 == m_pData) m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		memcpy(m_pData, &value, m_nLen);
		return *this;
	}

	XJAny & operator=(const unsigned char &value ){
		m_nType = TYPE_CHAR;
		if (m_nLen < sizeof(value)){
			if (m_pData){
				free(m_pData);
				m_pData = 0;
			}
		}
		m_nLen = sizeof(value);
		if (0 == m_pData) m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		memcpy(m_pData, &value, m_nLen);
		return *this;
	}



	XJAny & operator=(const float &value ){
		m_nType = TYPE_FLOAT;
		if (m_nLen < sizeof(value)){
			if (m_pData){
				free(m_pData);
				m_pData = 0;
			}
		}
		m_nLen = sizeof(value);
		if (0 == m_pData) m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		memcpy(m_pData, &value, m_nLen);
		return *this;
	}


	XJAny & operator=(const double &value ){
		m_nType = TYPE_DOUBLE;
		if (m_nLen < sizeof(value)){
			if (m_pData){
				free(m_pData);
				m_pData = 0;
			}
		}
		m_nLen = sizeof(value);
		if (0 == m_pData) m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		memcpy(m_pData, &value, m_nLen);
		return *this;
	}

	XJAny & operator=(const long double &value ){
		m_nType = TYPE_LONG_DOUBLE;
		if (m_nLen < sizeof(value)){
			if (m_pData){
				free(m_pData);
				m_pData = 0;
			}
		}
		m_nLen = sizeof(value);
		if (0 == m_pData) m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		memcpy(m_pData, &value, m_nLen);
		return *this;
	}

	XJAny & operator=(const std::string &value ){
		m_nType = TYPE_STRING;
		if (m_nLen < value.size()){
			if (m_pData){
				free(m_pData);
				m_pData = 0;
			}
		}
		m_nLen = value.size();
		if (0 == m_pData) m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		memcpy(m_pData, value.c_str(), m_nLen);
		return *this;
	}

	XJAny & operator=(const char * value ){
		m_nType = TYPE_STRING;
		if (m_nLen < strlen(value)){
			if (m_pData){
				free(m_pData);
				m_pData = 0;
			}
		}
		m_nLen = strlen(value);
		if (0 == m_pData) m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		memcpy(m_pData, value, m_nLen);
		return *this;
	}





	XJAny & operator=(const void * value){
		m_nType = TYPE_PTR;
		if (m_nLen < sizeof(void *)){
			if (m_pData){
				free(m_pData);
				m_pData = 0;
			}
		}
		m_nLen = sizeof(void *);
		if (0 == m_pData) m_pData = (char*)malloc(m_nLen+1);
		memset(m_pData, 0, m_nLen+1);
		*(long *)m_pData = (long)value;
		//memcpy(m_pData, &value, m_nLen);
		return *this;
	}



	XJAny & operator=(const  XJAny &any){
		if (this != &any){
			m_nType = any.m_nType;
			if (m_nLen < any.m_nLen){
				if (m_pData){
					free(m_pData);
					m_pData = 0;
				}
			}
			m_nLen = any.m_nLen;
			if (0 == m_pData) m_pData = (char*)malloc(m_nLen+1);
			memset(m_pData, 0, m_nLen+1);
			memcpy(m_pData, any.m_pData, m_nLen);
		}
		return *this;
	}



	enum XJANY_TYPE Type(){
		return m_nType;
	}

	const unsigned long Size(){
		return m_nLen;
	}

	const char* Data(){
		return m_pData;
	}

	const bool IsShort(){
		return IsIntegerType(TYPE_SHORT);
	}

	const short ToShort(){
		if (!IsShort()){
			throw XJExcepction("XJAny::ToShort() Excepction.");
		}
		unsigned long long llTmp = 0;
		try{
			llTmp = ToULongLong();
		}catch (XJExcepction &e) {
			throw XJExcepction("XJAny::ToShort() Excepction.");
		}
		return (short)llTmp;
	}

	const bool IsUShort(){
		return IsIntegerType(TYPE_SHORT);
	}

	const unsigned short ToUShort(){
		if (!IsUShort()){
			throw XJExcepction("XJAny::ToUShort() Excepction.");
		}
		unsigned long long llTmp = 0;
		try{
			llTmp = ToULongLong();
		}catch (XJExcepction &e) {
			throw XJExcepction("XJAny::ToUShort() Excepction.");
		}
		return (unsigned short)llTmp;
	}

	const bool IsInt(){
		return IsIntegerType(TYPE_INT);
	}

	const int ToInt(){
		if (!IsInt()){
			throw XJExcepction("XJAny::ToInt() Excepction.");
		}
		unsigned long long llTmp = 0;
		try{
			llTmp = ToULongLong();
		}catch (XJExcepction &e) {
			throw XJExcepction("XJAny::ToInt() Excepction.");
		}
		return (int)llTmp;
	}

	const bool IsUInt(){
		return IsIntegerType(TYPE_INT);
	}

	const unsigned int ToUInt(){
		if (!IsUInt()){
			throw XJExcepction("XJAny::ToUInt() Excepction.");
		}
		unsigned long long llTmp = 0;
		try{
			llTmp = ToULongLong();
		}catch (XJExcepction &e) {
			throw XJExcepction("XJAny::ToUInt() Excepction.");
		}
		return (unsigned int)llTmp;
	}

	const bool IsLong(){
		return IsIntegerType(TYPE_LONG);
	}

	const long ToLong(){
		if (!IsLong()){
			throw XJExcepction("XJAny::ToLong() Excepction.");
		}
		unsigned long long llTmp = 0;
		try{
			llTmp = ToULongLong();
		}catch (XJExcepction &e) {
			throw XJExcepction("XJAny::ToLong() Excepction.");
		}
		return (long)llTmp;
	}

	const bool IsULong(){
		return IsIntegerType(TYPE_LONG);
	}

	const unsigned long ToULong(){
		if (!IsULong()){
			throw XJExcepction("XJAny::ToULong() Excepction.");
		}
		unsigned long long llTmp = 0;
		try{
			llTmp = ToULongLong();
		}catch (XJExcepction &e) {
			throw XJExcepction("XJAny::ToULong() Excepction.");
		}
		return (unsigned long)llTmp;
	}
	const bool IsLongLong(){
		return IsIntegerType(TYPE_LONG_LONG);
	}
	const bool IsULongLong(){
		return IsIntegerType(TYPE_LONG_LONG);
	}
	const long long ToLongLong(){
		unsigned long long llTmp = 0;
		try{
			llTmp = ToULongLong();
		}catch (XJExcepction &e) {
			throw XJExcepction("XJAny::ToLongLong() Excepction.");
		}
		return (long long)llTmp;
	}
	const unsigned long long ToULongLong(){
		if (TYPE_SHORT != m_nType && TYPE_INT != m_nType
				&& TYPE_LONG != m_nType
				&& TYPE_LONG_LONG != m_nType
				&& TYPE_CHAR != m_nType){
			throw XJExcepction("XJAny::ToULongLong() Excepction.data type is not long long.");
		}
		unsigned long long llTmp = 0;
		if (sizeof(unsigned long long) == m_nLen){
			llTmp = *(unsigned long long *)m_pData;
		}else if (sizeof(unsigned long) == m_nLen){
			llTmp = *(unsigned long *)m_pData;
		}else if (sizeof(unsigned int) == m_nLen){
			llTmp = *(unsigned int *)m_pData;
		}else if (sizeof(unsigned short) == m_nLen){
			llTmp = *(unsigned short *)m_pData;
		}else if (sizeof(unsigned char) == m_nLen){
			llTmp = *(unsigned char *)m_pData;
		}else{
			throw XJExcepction("XJAny::ToULongLong() Excepction.data length is not sizeof(long long).");
		}
		return (long long)llTmp;
	}

	const bool IsChar(){
		return IsIntegerType(TYPE_CHAR);
	}

	const char ToChar(){
		if (!IsChar()){
			throw XJExcepction("XJAny::ToChar() Excepction.");
		}
		unsigned long long llTmp = 0;
		try{
			llTmp = ToULongLong();
		}catch (XJExcepction &e) {
			throw XJExcepction("XJAny::ToChar() Excepction.");
		}
		return (char)llTmp;
	}
	const bool IsUChar(){
		return IsIntegerType(TYPE_CHAR);
	}
	const unsigned char ToUChar(){
		if (!IsUChar()){
			throw XJExcepction("XJAny::ToUChar() Excepction.");
		}
		unsigned long long llTmp = 0;
		try{
			llTmp = ToULongLong();
		}catch (XJExcepction &e) {
			throw XJExcepction("XJAny::ToUChar() Excepction.");
		}
		return (unsigned char)llTmp;
	}
	const bool IsFloat(){
		return IsFloatType(TYPE_FLOAT);
	}
	const bool IsDouble(){
		return IsFloatType(TYPE_DOUBLE);
	}
	const bool IsLongDouble(){
		return IsFloatType(TYPE_LONG_DOUBLE);
	}
	const float ToFloat(){
		if (!IsFloat()){
			throw XJExcepction("XJAny::ToFloat() Excepction.data type or length is error.");
		}
		long double llTmp = 0;
		try{
			llTmp = ToLongDouble();
		}catch (XJExcepction  &e) {
			throw XJExcepction("XJAny::ToFloat() Excepction.");
		}
		return (float)llTmp;
	}
	const double ToDouble(){
		if (!IsDouble()){
			throw XJExcepction("XJAny::ToDouble() Excepction.data type or length is error.");
		}
		long double llTmp = 0;
		try{
			llTmp = ToLongDouble();
		}catch (XJExcepction  &e) {
			throw XJExcepction("XJAny::ToDouble() Excepction.");
		}
		return (double)llTmp;
	}
	const long double ToLongDouble(){
		if (TYPE_FLOAT != m_nType && TYPE_DOUBLE != m_nType
				&& TYPE_LONG_DOUBLE != m_nType){
			throw XJExcepction("XJAny::ToLongDouble() Excepction.data type is not long double.");
		}
		long double llTmp = 0;
		if (sizeof(long double) == m_nLen){
			llTmp = *(long double *)m_pData;
		}else if (sizeof(double) == m_nLen){
			llTmp = *(double *)m_pData;
		}else if (sizeof(float) == m_nLen){
			llTmp = *(float *)m_pData;
		}else{
			throw XJExcepction("XJAny::ToLongDouble() Excepction.data length is error.");
		}
		return llTmp;
	}
	const bool IsString(){
		if (TYPE_STRING != m_nType){
			return false;
		}
		return true;
	}
	const std::string ToString(){
		if (TYPE_STRING != m_nType){
			throw XJExcepction("XJAny::ToString() Excepction.data type is not string.");
		}
		return std::string(m_pData);
	}
	const bool IsPointer(){
		if (TYPE_PTR != m_nType){
			return false;
		}
		return true;
	}

	const char * ToPointer(){
		if (TYPE_PTR != m_nType){
			throw XJExcepction("XJAny::ToPointer() Excepction.data type is not void *.");
		}
		return *(char **)m_pData;
	}
	const char * TypeName(){
		INIT_XJANY_TYPENAME();
		return XJANY_TYPENAME[m_nType].c_str();
	}
protected:
	enum XJANY_TYPE m_nType;
	unsigned long m_nLen;
	char *m_pData;
private:
	const bool IsIntegerType(enum XJANY_TYPE nType){
		if (TYPE_SHORT != m_nType && TYPE_INT != m_nType
				&& TYPE_LONG != m_nType
				&& TYPE_LONG_LONG != m_nType
				&& TYPE_CHAR != m_nType){
			return false;
		}
		if (TYPE_SHORT != nType && TYPE_INT != nType
				&& TYPE_LONG != nType
				&& TYPE_LONG_LONG != nType){
			return false;
		}
		unsigned long long llTmp = 0;
		if (sizeof(unsigned long long) == m_nLen){
			if (TYPE_LONG_LONG == nType){
				return true;
			}
			llTmp = *(unsigned long long *)m_pData;
		}else if (sizeof(unsigned long) == m_nLen){
			if (TYPE_LONG_LONG == nType || TYPE_LONG == nType){
				return true;
			}
			llTmp = *(unsigned long *)m_pData;
		}else if (sizeof(unsigned int) == m_nLen){
			if (TYPE_LONG_LONG == nType || TYPE_LONG == nType
					|| TYPE_INT == nType){
				return true;
			}
			llTmp = *(unsigned int *)m_pData;
		}else if (sizeof(unsigned short) == m_nLen){
			if (TYPE_LONG_LONG == nType || TYPE_LONG == nType
					|| TYPE_INT == nType
					|| TYPE_SHORT == nType){
				return true;
			}
			llTmp = *(unsigned short *)m_pData;
		}else if (sizeof(unsigned char) == m_nLen){
			if (TYPE_LONG_LONG == nType || TYPE_LONG == nType
					|| TYPE_INT == nType
					|| TYPE_SHORT == nType
					|| TYPE_CHAR == nType){
				return true;
			}
			llTmp = *(unsigned char *)m_pData;
		}else{
			return false;
		}
		if (TYPE_CHAR == nType){
			unsigned char nTmp = (unsigned char)llTmp;
			if (nTmp != llTmp){
				return false;
			}
		}else if (TYPE_SHORT == nType){
			unsigned short nTmp = (unsigned short)llTmp;
			if (nTmp != llTmp){
				return false;
			}
		}else if (TYPE_INT == nType){
			unsigned int nTmp = (unsigned int)llTmp;
			if (nTmp != llTmp){
				return false;
			}
		}else if (TYPE_LONG == nType){
			unsigned long nTmp = (unsigned long)llTmp;
			if (nTmp != llTmp){
				return false;
			}
		}else if (TYPE_LONG_LONG == nType){

		}
		return true;
	}
	const bool IsFloatType(enum XJANY_TYPE nType){
		if (TYPE_FLOAT != m_nType && TYPE_DOUBLE != m_nType
				&& TYPE_LONG_DOUBLE != m_nType){
			return false;
		}
		if (TYPE_FLOAT != nType && TYPE_DOUBLE != nType
				&& TYPE_LONG_DOUBLE != nType){
			return false;
		}
		long double llTmp = 0;
		if (sizeof(long double) == m_nLen){
			if (TYPE_LONG_DOUBLE == nType){
				return true;
			}
			llTmp = *(long double *)m_pData;
		}else if (sizeof(double) == m_nLen){
			if (TYPE_LONG_DOUBLE == nType || TYPE_DOUBLE == nType){
				return true;
			}
			llTmp = *(double *)m_pData;
		}else if (sizeof(float) == m_nLen){
			if (TYPE_LONG_DOUBLE == nType || TYPE_DOUBLE == nType
					|| TYPE_FLOAT == nType){
				return true;
			}
			llTmp = *(float *)m_pData;
		}else{
			return false;
		}
		if (TYPE_FLOAT == nType){
			float nTmp = (float)llTmp;
			if (fabs(nTmp - llTmp) >= 0.000001){
				return false;
			}
		}else if (TYPE_DOUBLE == nType){
			double nTmp = (double)llTmp;
			if (fabs(nTmp - llTmp) >= 0.000001){
				return false;
			}
		}else if (TYPE_LONG_DOUBLE == nType){

		}
		return true;
	}

	static std::map<int, std::string> XJANY_TYPENAME;

	static void INIT_XJANY_TYPENAME();
};


} /* namespace XJUtilClass */

#endif /* XJANY_H_ */
